<template>
	<view class="page" style="background-color: #f3f3f3;">
		
		<cu-custom :bgColor="theme" :isBack="true" textColor="#000000">
			<block slot="backText">返回</block>
			<block slot="content">岗位详情</block>
		</cu-custom>
		
		<view class="all_jobs">
			<view class="jobs_item" style="margin-top: 0rpx;">
				<view @click="viewNewsInfo(item.id)">
					<view class="item_name_line">
						<view class="item_name" style="color: #000000;font-weight: bold;font-size: 33rpx;">{{newsDetail.zhaopindataGangwei}}</view>			
					</view>
					<view class="item_some_line">
						<view class="item_wage" style="color: #ffaf24;">{{newsDetail.zhaopindataXinzi | filterXinzi}}</view>
					</view>
				</view>
				<view class="item_some_line">
					<view class="item_wage">{{newsDetail.zhaopindataDiqu}}</view>
				</view>
				<view class="split_line"></view>
				<view style="margin-bottom: 15rpx;">
					<uni-row>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/isquanzhi.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataIsQuanzhi | filterIsQuanzhi}}</text>
						</uni-col>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/qiyerennum.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataRenshu}}人</text>
						</uni-col>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/fuli.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">福利面议</text>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/fuli.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataXueli | filterXueli}}</text>
						</uni-col>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/jingyan.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataJingyan | filterJingyan}}</text>
						</uni-col>
						<uni-col :span="8">
							<image class="img-yaoqiu-1" src="../../static/news/age.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataAge | filterAge}}</text>
						</uni-col>
					</uni-row>
				</view>
			</view>
			<view class="jobs_item">
				<view class="cdetail-all-wrap" style="width: 98%;">
					<view class="t_bar" style="top: 43rpx;"></view>
					<view class="content-title" style="color: #000000;margin-left: 0rpx;">职位描述</view>
					<view class="content-wrap">
						<rich-text class="content" :nodes="newsDetail.zhaopindataGangweiyaoqiu"></rich-text>
					</view>
				</view>
			</view>
			<view class="jobs_item" style="padding-bottom: 180rpx;">
				<view class="cdetail-all-wrap" style="width: 98%;">
					<view class="t_bar" style="top: 43rpx;"></view>
					<view class="content-title" style="color: #000000;margin-left: 0rpx;">公司信息</view>
					<view class="content-wrap">
						<view @click="viewNewsInfo(item.id)">
							<view class="item_name_line">
								<view class="item_name">{{newsDetail.zhaopindataQiye}}</view>			
							</view>
							<view class="item_some_line">
								<view class="item_wage" style="font-size: 20rpx;">{{newsDetail.zhaopindataXingzhi}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>				
		</view>
		
		<view style="width: 100%; position: fixed;bottom: 0; background-color: #FFFFFF;">
			<uni-grid :column="2" :show-border="true" :square="false">
				<uni-grid-item >
					<view class="grid-item-box" style="padding: 10rpx 0rpx 0rpx 0rpx;" @click="inputDialogToggle">
						<image class="image" src="../../static/news/phone.png" mode="aspectFill" style="width: 50rpx; height: 50rpx;"/>
						<text class="text" style="margin-top: 0rpx; color:#00e560;font-weight: bolder;">拨打电话</text>
					</view>
				</uni-grid-item>
				<uni-grid-item >
					<view class="grid-item-box" style="padding: 10rpx 0rpx 0rpx 0rpx;" @click="viewToNewsBackinfo">
						<image class="image" src="../../static/news/from.png" mode="aspectFill" style="width: 50rpx; height: 50rpx;"/>
						<text class="text" style="margin-top: 0rpx; color:#4db222;font-weight: bolder;">立即报名</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
		
	</view>
</template>
<script>
	import uniCol from '@/components/uni-ui/uni-row-col/uni-col/uni-col.vue';
	import uniRow from '@/components/uni-ui/uni-row-col/uni-row/uni-row.vue';
	import uniGrid from '@/components/uni-ui/uni-grid/uni-grid/uni-grid.vue';
	import uniGridItem from '@/components/uni-ui/uni-grid/uni-grid-item/uni-grid-item.vue';
	const app = getApp();
	export default {
		components: {
			uniCol,
			uniRow,
			uniGrid,
			uniGridItem,
		},
		data() {
			return {
				CustomBar: this.CustomBar,
				StatusBar: this.StatusBar,
				theme: app.globalData.theme.backgroundColor, //全局颜色变量
				
				newsDetail: {},
				lianluoyuanId:'',
			}
		},
		filters:{
			filterAge(type){
				switch(type){
					case '0':
						return '18岁~25岁'
						break;
					case '1':
						return '26岁~30岁'
						break;
					case '2':
						return '31岁~35岁'
						break;
					case '3':
						return '36岁~40岁'
						break;
					case '4':
						return '41岁~50岁'
						break;
					case '5':
						return '50岁以上'
						break;
				}
			},
			filterXinzi(type){
				switch(type){
					case '0':
						return '面议'
						break;
					case '1':
						return '1000~1500/月'
						break;
					case '2':
						return '1500~2000/月'
						break;
					case '3':
						return '2000~3000/月'
						break;
					case '4':
						return '3000~5000/月'
						break;
					case '5':
						return '5000以上/月'
						break;
				}
			},
			filterJingyan(type){
				switch(type){
					case '0':
						return '无经验'
						break;
					case '1':
						return '1年以下'
						break;
					case '2':
						return '1~3年'
						break;
					case '3':
						return '3~5年'
						break;
					case '4':
						return '5年以上'
						break;
				}
			},
			filterXueli(type){
				switch(type){
					case '0':
						return '初中'
						break;
					case '1':
						return '高中'
						break;
					case '2':
						return '中技/中专'
						break;
					case '3':
						return '大专'
						break;
					case '4':
						return '本科'
						break;
					case '5':
						return '硕士'
						break;
				}
			},
			filterIsQuanzhi(type){
				switch(type){
					case '0':
						return '全职'
						break;
					case '1':
						return '兼职'
						break;
				}
			},
		},
		onLoad(option) {
			this.getNewsInfo(option.zhaopindata_id);
			this.lianluoyuanId = option.lianluoyuan_id;
		},
		methods: {
			inputDialogToggle() {
				uni.showModal({
					title: '咨询电话',
					content: app.globalData.aboutPhone,
					showCancel: false,
					confirmText:'拨打电话',
					success: (res) => {
						if(res.confirm) {  
							uni.makePhoneCall({
								phoneNumber: app.globalData.aboutPhone,  // 手机号
								success: (res) => {
									console.log('调用成功!')	
								},
								fail: (res) => {
									console.log('调用失败!')
								}
							});
						}
					} 
				})
			},
			
			getNewsInfo(zhaopindataId) {
				uni.request({
					url: app.globalData.serve_job_url + zhaopindataId,
					method: 'GET',
					data: {
					},
					success: res => {
						this.newsDetail = res.data.data;
					},
				});
			},
            // 立即报名
			viewToNewsBackinfo() {
				uni.navigateTo({
					url: './news-backinfo-fx?zhaopindataId=' + this.newsDetail.zhaopindataId + '&zhaopindataGangwei=' 
															 + this.newsDetail.zhaopindataGangwei + '&lianluoyuanId=' + this.lianluoyuanId,
				});
			},
		}
	}
</script>
<style lang="scss">
	.t_bar {
		position: absolute;
		left: 25rpx;
		-webkit-transform: translate(0, -50%);
		transform: translate(0, -50%);
		width: 7rpx;
		height: 30rpx;
		background: #1787fb;
	}
	.content-wrap{
		margin-top: 20rpx;
		margin-left: 0rpx !important;
	}
	.text {
		font-size: 14px;
		margin-top: 5px;
	}
	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}
	.txt-yaoqiu-1{
		margin-left: 10rpx;
	}
	.img-yaoqiu-1{
		position: relative;
		top: 10rpx;
	}
	.all_jobs{
		width: 100%;
		border-top: #e2e2e2 thin solid;
	}
	.jobs_item{
		position: relative;
		width: 100%;
		background: #FFFFFF;
		margin-top: 12rpx;
		padding: 20rpx 35rpx 18rpx 35rpx;
	}
	.all_jobs .jobs_item .item_name_line {
		position: relative;
		height: 55rpx;
		line-height: 55rpx;
	}
	.all_jobs .jobs_item .item_name_line .item_name{
		display: block;
		float: left;
/* 		margin-right: 0.15rem;
		max-width: 4.2rem; */
		height: 45rpx;
		line-height: 45rpx;
		text-decoration: none;
		color: #333333;
		font-size: 33rpx;
	}
	.all_jobs .jobs_item .item_name_line .item_wage{
			position: absolute;
			right: 2rpx;
			top: 50%;
			-webkit-transform: translate(0, -50%);
			transform: translate(0, -50%);
			color: #ffaf24;
			line-height: normal;
			font-size: 25rpx;
	}
	.all_jobs .jobs_item .item_some_line{
		position: relative;
		height: 55rpx;
		line-height: 55rpx;
		margin-bottom: 10rpx;
	}
	.all_jobs .jobs_item .item_some_line .item_some{
/* 		max-width: 5rem; */
		height: 45rpx;
		line-height: 45rpx;
		color: #666666;
		font-size: 27rpx;
	}  
	.all_jobs .jobs_item .item_some_line .item_date{
			position: absolute;
			right: 2rpx;
			top: 0;
			height: 45rpx;
			line-height:45rpx;
			color: #999999;
			font-size: 23rpx;
	}
	.all_jobs .jobs_item .split_line{
		width: 100%;
		border-bottom: 2rpx solid #e2e2e2;
		margin: 10rpx 0rpx 20rpx 0rpx;
	}
</style>